package com.yh.ssm.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.yh.ssm.common.Result;
import com.yh.ssm.common.query.Query;
import com.yh.ssm.domain.TTopic;
import com.yh.ssm.query.TtopicQuery;
import com.yh.ssm.service.TTopicService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.yh.ssm.mapper.TTopicMapper;

import java.util.List;

/**
 * @ClassName: TTopicServiceImpl.java
 * @author: yuhui
 * @version: 1.0.0
 * @Description: TODO
 * @createTime: 2021年04月29日 09:27:00
 */
@Service
public class TTopicServiceImpl implements TTopicService {

    @Resource
    private TTopicMapper tTopicMapper;

    @Override
    public Result getInfo(TtopicQuery ttopicQuery) {
        Page<TTopic> TTopics = PageHelper.startPage(ttopicQuery.getPage(), ttopicQuery.getLimit());
        tTopicMapper.selectData(ttopicQuery);
        return new Result(TTopics.toPageInfo());
    }

    @Override
    public Result getInfoById(TtopicQuery ttopicQuery) {
        Page<TTopic> objects = PageHelper.startPage(ttopicQuery.getPage(), ttopicQuery.getLimit());
        tTopicMapper.getDataById(ttopicQuery);
        return new Result(objects.toPageInfo());
    }
}
